<template>
  <div class="my">
    <div class="my-head">
      <div class="user">
        <img src="../../assets/avatar/avatar.png" alt="" srcset="" />
        <span> {{ infpo.name }} </span>
      </div>
      <div class="my-num">
        <div class="num-lt">
          {{ infpo.balance | getmoney }}<span>rs</span>
          <p>Balance</p>
        </div>
        <div class="num-rt">
          <button @click="$router.push('/accountrecord')">
            Account Record
          </button>
        </div>
      </div>
    </div>
    <div class="my-card">
      <div class="card-lt" @click="$router.push('/withdrawal')">
        <img src="../../assets/imgs/Withdrawal.png" alt="" srcset="" />
        <p>Withdrawal</p>
      </div>
      <div class="card-rt" @click="$router.push('/recharge')">
        <img src="../../assets/imgs/Recharge@2x.png" alt="" srcset="" />
        <p>Recharge</p>
      </div>
    </div>
    <ul class="set-list">
      <li @click="$router.push('/investmentrecord')">
        <div class="lt">
          <i class="iconfont icon-a-InvestmentRecord"></i>
          <span>Investment Record</span>
        </div>
        <div class="rt">
          <van-icon name="arrow" size="20" color="#ADB4C7" />
        </div>
      </li>
      <li @click="$router.push('/bankcard')">
        <div class="lt">
          <i class="iconfont icon-a-BankCard"></i>
          <span>Bank Card</span>
        </div>
        <div class="rt">
          <van-icon name="arrow" size="20" color="#ADB4C7" />
        </div>
      </li>
      <li @click="$router.push('/changepassword')">
        <div class="lt">
          <i class="iconfont icon-xiugaimima-01"></i>
          <span>Change password</span>
        </div>
        <div class="rt">
          <van-icon name="arrow" size="20" color="#ADB4C7" />
        </div>
      </li>
      <li @click="$router.push('/onlineservice')">
        <div class="lt">
          <i class="iconfont icon-kefu"></i>
          <span>Online Service</span>
        </div>
        <div class="rt">
          <van-icon name="arrow" size="20" color="#ADB4C7" />
        </div>
      </li>
    </ul>
    <div class="logout">
      <button @click="loginout">Log Out</button>
    </div>
  </div>
</template>
<script>
import { getStorage } from "@/utils/common";
export default {
  data() {
    return {
      infpo: {},
      avatar: "../../assets/avatar/avatar.png",
    };
  },
  mounted() {
    this.$store.dispatch("getperons").then((res) => {
      // let persons = JSON.parse(getCookie(" perons"));
      let persons = JSON.parse(getStorage("infpo"));
      this.infpo = persons;
    });
  },
  methods: {
    loginout() {
      this.$store.dispatch("loginout");
    },
  },
};
</script>
<style lang='scss' scoped>
.my {
  height: 100%;
  min-height: 100vh;
  background-color: #fff;
}
.my-head {
  width: 100%;
  height: 180px;
  background: #4a67f5;
  .user {
    display: flex;
    align-items: center;
    padding: 20px 15px;
    img {
      width: 20px;
      height: 20px;
    }
    span {
      margin: 0 0 0 5px;
      color: #ffffff;
      font-size: 15px;
    }
  }
  .my-num {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    .num-lt {
      color: #fff;
      font-size: 40px;
      span {
        font-size: 15px;
      }
      p {
        font-size: 13px;
      }
    }
    button {
      width: 120px;
      height: 35px;
      border: 1px solid #ffffff;
      border-radius: 23px;
      background-color: #4a67f5;
      color: #fff;
    }
  }
}
.my-card {
  margin: -40px auto 20px auto;
  width: 345px;
  height: 94px;
  background: #ffffff;
  box-shadow: 0px 4px 9px rgba(74, 103, 245, 0.2);
  border-radius: 10px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  text-align: center;
  img {
    width: 30px;
    height: 30px;
  }
  p {
    padding: 5px 0 0 0;
    font-size: 14px;
    color: #666666;
  }
}
.set-list {
  padding: 0 15px;
  font-size: 15px;
  .iconfont {
    font-size: 20px;
    color: #4a67f5;
  }
  li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #e2e2e2;
    span {
      margin: 0 0 0 10px;
      color: #12182c;
    }
  }
}
.logout {
  button {
    width: 300px;
    height: 50px;
    background: #eceffe;
    border-radius: 105px;
    border: none;
    color: #4a67f5;
    font-size: 17px;
  }
  margin: 20px auto 90px auto;
  text-align: center;
}
</style>